<?
session_start();
include('config/db_settings.php');

$dbhost = $db_settings['host'];
$dbusername = $db_settings['user'];
$dbpasswd = $db_settings['password'];
$database_name = $db_settings['database'];

function connect_db($host,$user,$pw,$db)
{
	global $lang;
	$connid = @mysql_connect($host, $user, $pw);
	@mysql_select_db($db, $connid);
	mysql_query("set names utf8");
	return $connid;
}

/**
 * fetches settings from database
 */
function get_settings()
{
	global  $db_settings, $settings;
	$result = mysql_query("SELECT name, value FROM ".$db_settings['settings_table']);
	while ($line = mysql_fetch_array($result))
	{
		$settings[$line['name']] = stripslashes($line['value']);
	}
	mysql_free_result($result);
}


connect_db($dbhost,$dbusername,$dbpasswd,$database_name);
if(mysql_error()==""){
	get_settings();
}

if(isset($_GET['flowers']))
 {
  $flowers = intval($_GET['flowers']);
  if($flowers!=0) $flowers = 1;
  
  $_SESSION[$settings['session_prefix'].'flowers'] = $flowers;
  setcookie($settings['session_prefix'].'flowers',$_SESSION[$settings['session_prefix'].'flowers'],time()+(3600*24*30));
 }  
 
header('Location:index.php');
exit;
?>